home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / misc / WHDLoad_dev.lha / WHDLoad / Include / whdload.i < prev   
Text File  |  1999-02-15  |  19KB  |  653 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Module.    whdload.i
  3. ;  :Contens.    include file for WHDLoad and his Slaves
  4. ;  :Author.    Bert Jahn
  5. ;  :EMail.    wepl@kagi.com
  6. ;  :Address.    Franz-Liszt-Straße 16, Rudolstadt, 07404, Germany
  7. ;  :Version.    $Id: whdload.i 9.2125 1999/02/14 23:31:57 jah Exp jah $
  8. ;  :History.
  9. ;  :Copyright.    © 1996,1997,1998 Bert Jahn, All Rights Reserved
  10. ;  :Language.    68000 Assembler
  11. ;  :Translator.    Barfly V1.131
  12. ;---------------------------------------------------------------------------*
  13.  
  14.  IFND WHDLOAD_I
  15. WHDLOAD_I=1
  16.  
  17.     IFND    EXEC_EXECBASE_I
  18.     INCLUDE    exec/execbase.i
  19.     ENDC
  20.     IFND    EXEC_TYPES_I
  21.     INCLUDE    exec/types.i
  22.     ENDC
  23.     IFND    GRAPHICS_MODEID_I
  24.     INCLUDE    graphics/modeid.i
  25.     ENDC
  26.     IFND    HARDWARE_CIA_I
  27.     INCLUDE    hardware/cia.i
  28.     ENDC
  29.     IFND    HARDWARE_CUSTOM_I
  30.     INCLUDE    hardware/custom.i
  31.     ENDC
  32.     IFND    HARDWARE_INTBITS_I
  33.     INCLUDE    hardware/intbits.i
  34.     ENDC
  35.     IFND    HARDWARE_DMABITS_I
  36.     INCLUDE    hardware/dmabits.i
  37.     ENDC
  38.     IFND    UTILITY_TAGITEM_I
  39.     INCLUDE    utility/tagitem.i
  40.     ENDC
  41.  
  42. ;some custom stuff
  43.  
  44.  BITDEF POTGO,OUTRY,15
  45.  BITDEF POTGO,DATRY,14
  46.  BITDEF POTGO,OUTRX,13
  47.  BITDEF POTGO,DATRX,12
  48.  BITDEF POTGO,OUTLY,11
  49.  BITDEF POTGO,DATLY,10
  50.  BITDEF POTGO,OUTLX,9
  51.  BITDEF POTGO,DATLX,8
  52.  BITDEF POTGO,START,0
  53.  
  54. _ciaa        = $bfe001
  55. _ciab        = $bfd000
  56. _custom        = $dff000
  57.  
  58. ;=============================================================================
  59. ;    misc
  60. ;=============================================================================
  61.  
  62. SLAVE_HEADER    MACRO
  63.         moveq    #-1,d0
  64.         rts
  65.         dc.b    "WHDLOADS"
  66.         ENDM
  67.  
  68. ;=============================================================================
  69. ;    some useful macros
  70. ;=============================================================================
  71. ****************************************************************
  72. ***** write opcode ILLEGAL to specified address
  73. ill    MACRO
  74.     IFNE    NARG-1
  75.         FAIL    arguments "ill"
  76.     ENDC
  77.         move.w    #$4afc,\1
  78.     ENDM
  79. ****************************************************************
  80. ***** write opcode RTS to specified address
  81. ret    MACRO
  82.     IFNE    NARG-1
  83.         FAIL    arguments "ret"
  84.     ENDC
  85.         move.w    #$4e75,\1
  86.     ENDM
  87. ****************************************************************
  88. ***** skip \1 instruction bytes on address \2
  89. skip    MACRO
  90.     IFNE    NARG-2
  91.         FAIL    arguments "skip"
  92.     ENDC
  93.     IFLE \1-126
  94.         move.w    #$6000+\1-2,\2
  95.     ELSE
  96.     IFLE \1-32766
  97.         move.l    #$60000000+\1-2,\2
  98.     ELSE
  99.         FAIL    "skip: distance to large"
  100.     ENDC
  101.     ENDC
  102.     ENDM
  103. ****************************************************************
  104. ***** write \1 times opcode NOP starting at address \2
  105. ***** (better to use "skip" instead)
  106. nops    MACRO
  107.     IFNE    NARG-2
  108.         FAIL    arguments "nops"
  109.     ENDC
  110.         movem.l    d0/a0,-(a7)
  111.         IFGT \1-127
  112.             move.w    #\1-1,d0
  113.         ELSE
  114.             moveq    #\1-1,d0
  115.         ENDC
  116.         lea    \2,a0
  117. .lp\@        move.w    #$4e71,(a0)+
  118.         dbf    d0,.lp\@
  119.         movem.l    (a7)+,d0/a0
  120.     ENDM
  121. ****************************************************************
  122. ***** write opcode JMP \2 to address \1
  123. patch    MACRO
  124.     IFNE    NARG-2
  125.         FAIL    arguments "patch"
  126.     ENDC
  127.         move.w    #$4ef9,\1
  128.         pea    \2
  129.         move.l    (a7)+,2+\1
  130.     ENDM
  131. ****************************************************************
  132. ***** write opcode JSR \2 to address \1
  133. patchs    MACRO
  134.     IFNE    NARG-2
  135.         FAIL    arguments "patchs"
  136.     ENDC
  137.         move.w    #$4eb9,\1
  138.         pea    \2
  139.         move.l    (a7)+,2+\1
  140.     ENDM
  141. ****************************************************************
  142. ***** wait that blitter has finished his job
  143. ***** (this is adapted from graphics.WaitBlit, see autodocs for
  144. *****  hardware bugs and possible problems ...)
  145. ***** if \1 is given it must be an address register containing _custom
  146. BLITWAIT MACRO
  147.     IFEQ    NARG-1
  148.         tst.b    (dmaconr,\1)
  149. .waitb\@    tst.b    (_ciaa)        ;this avoids blitter slow down
  150.         tst.b    (_ciaa)
  151.         btst    #DMAB_BLTDONE-8,(dmaconr,\1)
  152.         bne.b    .waitb\@
  153.         tst.b    (dmaconr,\1)
  154.     ELSE
  155.         tst.b    (_custom+dmaconr)
  156. .waitb\@    tst.b    (_ciaa)        ;this avoids blitter slow down
  157.         tst.b    (_ciaa)
  158.         btst    #DMAB_BLTDONE-8,(_custom+dmaconr)
  159.         bne.b    .waitb\@
  160.         tst.b    (_custom+dmaconr)
  161.     ENDC
  162.     ENDM
  163. ****************************************************************
  164. ***** wait of vertical blank
  165. ***** if \1 is given it must be an address register containing _custom
  166. waitvb    MACRO
  167.     IFEQ    NARG-1
  168. .1\@        btst    #0,(vposr+1,\1)
  169.         beq    .1\@
  170. .2\@        btst    #0,(vposr+1,\1)
  171.         bne    .2\@
  172.     ELSE
  173. .1\@        btst    #0,(_custom+vposr+1)
  174.         beq    .1\@
  175. .2\@        btst    #0,(_custom+vposr+1)
  176.         bne    .2\@
  177.     ENDC
  178.     ENDM
  179. ****************************************************************
  180. ***** wait for pressing any button
  181. ***** if \1 is given it must be an address register containing _custom
  182. waitbutton    MACRO
  183.     IFEQ    NARG
  184.         move.l    a0,-(a7)
  185.         lea    (_custom),a0
  186. .down\@        bsr    .wait\@
  187.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  188.         beq    .up\@
  189.         btst    #POTGOB_DATLY-8,(potinp,a0)        ;RMB
  190.         beq    .up\@
  191.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  192.         bne    .down\@
  193. .up\@        bsr    .wait\@                    ;entprellen
  194.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  195.         beq    .up\@
  196.         btst    #POTGOB_DATLY-8,(potinp,a0)        ;RMB
  197.         beq    .up\@
  198.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  199.         beq    .up\@
  200.         bsr    .wait\@                    ;entprellen
  201.         bra    .done\@
  202. .wait\@        waitvb    a0
  203.         rts
  204. .done\@        move.l    (a7)+,a0
  205.     ELSE
  206.     IFEQ    NARG-1
  207. .down\@        bsr    .wait\@
  208.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  209.         beq    .up\@
  210.         btst    #POTGOB_DATLY-8,(potinp,\1)        ;RMB
  211.         beq    .up\@
  212.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  213.         bne    .down\@
  214. .up\@        bsr    .wait\@                    ;entprellen
  215.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  216.         beq    .up\@
  217.         btst    #POTGOB_DATLY-8,(potinp,\1)        ;RMB
  218.         beq    .up\@
  219.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  220.         beq    .up\@
  221.         bsr    .wait\@                    ;entprellen
  222.         bra    .done\@
  223. .wait\@        waitvb    \1
  224.         rts
  225. .done\@
  226.     ELSE
  227.         FAIL    arguments "waitbutton"
  228.     ENDC
  229.     ENDC
  230.     ENDM
  231.  
  232. waitbuttonup    MACRO
  233.     IFEQ    NARG
  234.         move.l    a0,-(a7)
  235.         lea    (_custom),a0
  236. .up\@        bsr    .wait\@                    ;entprellen
  237.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  238.         beq    .up\@
  239.         btst    #POTGOB_DATLY-8,(potinp,a0)        ;RMB
  240.         beq    .up\@
  241.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  242.         beq    .up\@
  243.         bsr    .wait\@                    ;entprellen
  244.         bra    .done\@
  245. .wait\@        waitvb    a0
  246.         rts
  247. .done\@        move.l    (a7)+,a0
  248.     ELSE
  249.     IFEQ    NARG-1
  250. .up\@        waitvb    \1                    ;entprellen
  251.         btst    #CIAB_GAMEPORT0,(ciapra+_ciaa)        ;LMB
  252.         beq    .up\@
  253.         btst    #POTGOB_DATLY-8,(potinp,\1)        ;RMB
  254.         beq    .up\@
  255.         btst    #CIAB_GAMEPORT1,(ciapra+_ciaa)        ;FIRE
  256.         beq    .up\@
  257.         waitvb    \1                    ;entprellen
  258.     ELSE
  259.         FAIL    arguments "waitbuttonup"
  260.     ENDC
  261.     ENDC
  262.     ENDM
  263. ****************************************************************
  264. ***** flash the screen and wait for LMB
  265. blitz        MACRO
  266.         move    #$1200,bplcon0+_custom
  267.     ;    move    #DMAF_SETCLR|DMAF_RASTER,dmacon+_custom
  268.         move.l    d0,-(a7)
  269. .lpbl\@        move.w    d0,$dff180
  270.         subq.w    #1,d0
  271.         btst    #6,$bfe001
  272.         bne    .lpbl\@
  273.         waitvb                    ;entprellen
  274.         waitvb                    ;entprellen
  275. .lp2bl\@    move.w    d0,$dff180
  276.         subq.w    #1,d0
  277.         btst    #6,$bfe001
  278.         beq    .lp2bl\@
  279.         waitvb                    ;entprellen
  280.         waitvb                    ;entprellen
  281.         clr.w    color+_custom
  282.         move.l    (a7)+,d0
  283.         ENDM
  284. ****************************************************************
  285. ***** color the screen and wait for LMB
  286. bwait        MACRO
  287.         move    #$1200,bplcon0+_custom
  288. .wd\@
  289.     IFEQ NARG
  290.         move.w    #$ff0,color+_custom        ;yellow
  291.     ELSE
  292.         move.w    #\1,color+_custom
  293.     ENDC
  294.         btst    #6,$bfe001
  295.         bne    .wd\@
  296.         waitvb                    ;entprellen
  297.         waitvb                    ;entprellen
  298. .wu\@        btst    #6,$bfe001
  299.         beq    .wu\@
  300.         waitvb                    ;entprellen
  301.         waitvb                    ;entprellen
  302.         clr.w    color+_custom
  303.         ENDM
  304. ****************************************************************
  305. ***** install Vertical-Blank-Interrupt which quits on LMB pressed
  306. QUITVBI        MACRO
  307.         move.l    a0,-(a7)
  308.         lea    .vbi,a0
  309.         move.l    a0,$6c
  310.         bra    .g
  311. .vbi        btst    #6,$bfe001
  312.         beq    .vbi+1        ;create "address error"
  313.         move.w    #INTF_VERTB,_custom+intreq
  314.         rte
  315. .g        move.w    #INTF_SETCLR|INTF_INTEN|INTF_VERTB,_custom+intena
  316.         move.w    #INTF_VERTB,_custom+intreq
  317.         move.l    (a7)+,a0
  318.     ENDM
  319. ****************************************************************
  320. ***** set all registers to zero
  321. resetregs    MACRO
  322.         moveq    #0,d0
  323.         moveq    #0,d1
  324.         moveq    #0,d2
  325.         moveq    #0,d3
  326.         moveq    #0,d4
  327.         moveq    #0,d5
  328.         moveq    #0,d6
  329.         moveq    #0,d7
  330.         sub.l    a0,a0
  331.         sub.l    a1,a1
  332.         sub.l    a2,a2
  333.         sub.l    a3,a3
  334.         sub.l    a4,a4
  335.         sub.l    a5,a5
  336.         sub.l    a6,a6
  337.     ENDM
  338. ;=============================================================================
  339. ;    return-values for termination (resload_Abort)
  340. ;=============================================================================
  341.  
  342. TDREASON_OK        = -1    ;normal termination
  343. TDREASON_DOSREAD    = 1    ;error with resload_ReadFile
  344.                 ;primary   = dos errorcode
  345.                 ;secondary = file name
  346. TDREASON_DOSWRITE    = 2    ;error with resload_SaveFile/resload_SaveFileOffset
  347.                 ;primary   = dos errorcode
  348.                 ;secondary = file name
  349. TDREASON_DEBUG        = 5    ;make coredump and quit
  350.                 ;primary   = PC
  351.                 ;secondary = SR
  352. TDREASON_DOSLIST    = 6    ;error with resload_ListFiles
  353.                 ;primary   = dos errorcode
  354.                 ;secondary = directory name
  355. TDREASON_DISKLOAD    = 7    ;error with resload_DiskLoad
  356.                 ;primary   = dos errorcode
  357.                 ;secondary = disk number
  358. TDREASON_DISKLOADDEV    = 8    ;error with resload_DiskLoadDev
  359.                 ;primary   = trackdisk errorcode
  360. TDREASON_WRONGVER    = 9    ;an version check (e.g. crc16) has detected an
  361.                 ;unsupported version of data files
  362. TDREASON_OSEMUFAIL    = 10    ;error in the OS emulation module
  363.                 ;primary   = subsystem (e.g. "exec.library")
  364.                 ;secondary = error number (e.g. #_LVOAllocMem)
  365. ; version 7
  366. TDREASON_REQ68020    = 11    ;Slave/installed program requires 68020
  367. TDREASON_REQAGA        = 12    ;Slave/installed program requires AGA Chip Set
  368. TDREASON_MUSTNTSC    = 13    ;installed program needs NTSC to run
  369. TDREASON_MUSTPAL    = 14    ;installed program needs PAL to run
  370. ; version 8
  371. TDREASON_MUSTREG    = 15    ;whdload must be registered
  372. TDREASON_DELETEFILE    = 27    ;error with resload_DeleteFile
  373.                 ;primary   = dos errorcode
  374.                 ;secondary = file name
  375.  
  376. ;=============================================================================
  377. ; tagitems for various resload functions
  378. ;=============================================================================
  379.  
  380.  ENUM    TAG_USER+$8000000
  381.  EITEM    WHDLTAG_ATTNFLAGS_GET    ;get exec.AttnFlags
  382.                  ;(see "Includes:exec/execbase.i")
  383.  EITEM    WHDLTAG_ECLOCKFREQ_GET    ;get exec.EClockFrequency
  384.                  ;(see "Includes:exec/execbase.i")
  385.  EITEM    WHDLTAG_MONITOR_GET    ;get the used monitor (NTSC_MONITOR_ID or PAL_MONITOR_ID)
  386.  EITEM    WHDLTAG_Private1
  387.  EITEM    WHDLTAG_Private2
  388.  EITEM    WHDLTAG_Private3
  389.  EITEM    WHDLTAG_BUTTONWAIT_GET    ;get value of argument/tooltype ButtonWait/S (0/-1)
  390.  EITEM    WHDLTAG_CUSTOM1_GET    ;get value of argument/tooltype Custom1/N (integer)
  391.  EITEM    WHDLTAG_CUSTOM2_GET    ;get value of argument/tooltype Custom2/N (integer)
  392.  EITEM    WHDLTAG_CUSTOM3_GET    ;get value of argument/tooltype Custom3/N (integer)
  393.  EITEM    WHDLTAG_CUSTOM4_GET    ;get value of argument/tooltype Custom4/N (integer)
  394.  EITEM    WHDLTAG_CUSTOM5_GET    ;get value of argument/tooltype Custom5/N (integer)
  395. ; version 7
  396.  EITEM    WHDLTAG_CBSWITCH_SET    ;set callback function to execute on switch to
  397.                 ;installed program (see autodoc)
  398.  EITEM    WHDLTAG_CHIPREVBITS_GET    ;get gfx.ChipRevBits
  399.                 ;(see "Includes:graphics/gfxbase.i")
  400. ; version 8
  401.  EITEM    WHDLTAG_IOERR_GET    ;get dos error code from last resload function
  402.  EITEM    WHDLTAG_Private4
  403. ; version 9
  404.  EITEM    WHDLTAG_CBAF_SET    ;set callback function to execute when access 
  405.                 ;fault occurs (see autodoc)
  406.  EITEM    WHDLTAG_VERSION_GET    ;get WHDLoad version number (major)
  407.  EITEM    WHDLTAG_REVISION_GET    ;get WHDLoad revision number (minor)
  408.  EITEM    WHDLTAG_BUILD_GET    ;get WHDLoad build number
  409.  EITEM    WHDLTAG_TIME_GET    ;gets pointer to filled whdload_time structure
  410.  
  411. ;=============================================================================
  412. ;    structure returned by WHDLTAG_TIME_GET
  413. ;=============================================================================
  414.  
  415.     STRUCTURE whdload_time,0
  416.         ULONG    whdlt_days    ;days since 1.1.1978
  417.         ULONG    whdlt_mins    ;minutes since last day
  418.         ULONG    whdlt_ticks    ;1/50 seconds since last minute
  419.         UBYTE    whdlt_year    ;78..77 (1978..2077)
  420.         UBYTE    whdlt_month    ;1..12
  421.         UBYTE    whdlt_day    ;1..31
  422.         UBYTE    whdlt_hour    ;0..23
  423.         UBYTE    whdlt_min    ;0..59
  424.         UBYTE    whdlt_sec    ;0..59
  425.         LABEL    whdlt_SIZEOF
  426.  
  427. ;=============================================================================
  428. ; Slave        Version 1..3
  429. ;=============================================================================
  430.  
  431.     STRUCTURE    WhdloadSlave,0
  432.     STRUCT    ws_Security,4    ;moveq #-1,d0 + rts
  433.     STRUCT    ws_ID,8        ;"WHDLOADS"
  434.     UWORD    ws_Version    ;version of Whdload that is required
  435.     UWORD    ws_Flags    ;see below
  436.     ULONG    ws_BaseMemSize    ;size of mem required by game
  437.                 ;(must be multiple of $1000, max=$200000)
  438.     ULONG    ws_ExecInstall    ;address in BaseMem where is space for a fake
  439.                 ;ExecLibrary installed by the WHDLoad to
  440.                 ;survive a RESET
  441.                 ;for example $400
  442.                 ;required are at least 84 Bytes
  443.                 ;=0 means unsupported
  444.     RPTR    ws_GameLoader    ;start of slave-code
  445.                 ;will called from WHDLoad after init in
  446.                 ;SuperVisor
  447.                 ;slave must be 100.00% PC-RELATIVE !
  448.     RPTR    ws_CurrentDir    ;subdirectory in which WHDLoad should search
  449.                 ;for files
  450.     RPTR    ws_DontCache    ;pattern string for files which must not cached
  451.                 ;starting WHDLoad 0.107 this is obsolete
  452.  
  453. ;=============================================================================
  454. ; additional    Version 4..7
  455. ;=============================================================================
  456.  
  457.     UBYTE    ws_keydebug    ;raw key code to quit with debug
  458.                 ;works only if vbr is moved !
  459.                 ;=0 means no key
  460.     UBYTE    ws_keyexit    ;raw key code to exit
  461.                 ;works only if vbr is moved !
  462.                 ;=0 means no key
  463.  
  464. ;=============================================================================
  465. ; additional    Version 8
  466. ;=============================================================================
  467.  
  468.     ULONG    ws_ExpMem    ;size of required expansions memory, during
  469.                 ;initialisation will be overwritten by WHDLoad
  470.                 ;with address of the memory
  471.     LABEL    ws_SIZEOF
  472.  
  473. ;=============================================================================
  474. ; Flags for ws_Flags
  475. ;=============================================================================
  476.  
  477.     BITDEF WHDL,Disk,0    ;means diskimages are used by the slave
  478.                 ;result is a different PRELOAD
  479.                 ;starting WHDLoad 0.107 this is obsolete
  480.     BITDEF WHDL,NoError,1    ;if enabled every error occuring in a
  481.                 ;resload_#? function will immedately quit the
  482.                 ;slave, and whdload will prompt an error
  483.                 ;requester
  484.     BITDEF WHDL,EmulTrap,2    ;if set and the vbr is moved TRAP #0-15 are
  485.                 ;emulated like the autovectors
  486.     BITDEF WHDL,NoDivZero,3    ;if set and the VBR is moved by WHDLoad, it
  487.                 ;will not quit if a "Division by Zero"
  488.                 ;exception occurs, a simple rte will performed
  489.                 ;instead
  490. ; version 7
  491.     BITDEF WHDL,Req68020,4    ;indicates that the Slave/installed program
  492.                 ;requires at least a MC68020 cpu
  493.     BITDEF WHDL,ReqAGA,5    ;indicates that the Slave/installed program
  494.                 ;requires the AGA chipset
  495. ; version 8
  496.     BITDEF WHDL,NoKbd,6    ;says WHDLoad that it doesn't should get the
  497.                 ;keycode from the keyboard in conjunction with
  498.                 ;NoVBRMove, must be used if the installed
  499.                 ;program checks the keyboard from the VBI
  500.     BITDEF WHDL,EmulLineA,7    ;if set and the vbr is moved Line-A
  501.                 ;instructions (opcodes starting with %1010)
  502.                 ;are emulated like the autovectors
  503. ; version 9
  504.     BITDEF WHDL,EmulTrapV,8    ;if set and the vbr is moved trap-v
  505.                 ;instructions are emulated like the
  506.                 ;autovectors
  507.  
  508. ;=============================================================================
  509. ; resload_#? functions
  510. ; a JMP-tower in WHDLoad (similar to a library)
  511. ; base is given on startup via A0
  512. ;=============================================================================
  513.  
  514.     STRUCTURE    ResidentLoader,0
  515.     ULONG    resload_Install        ;(private)
  516.     ULONG    resload_Abort
  517.         ; return to operating system
  518.         ; IN: (a7) = ULONG  success (one of TDREASON_xxx)
  519.         ;   (4,a7) = ULONG  primary error code
  520.         ;   (8,a7) = ULONG  secondary error code
  521.         ; OUT :    -
  522.         ; DANGER this routine must called via JMP ! (not JSR)
  523.     ULONG    resload_LoadFile
  524.         ; load to BaseMem
  525.         ; IN :    a0 = CPTR   name of file
  526.         ;    a1 = APTR   address
  527.         ; OUT :    d0 = BOOL   success (size of file)
  528.         ;    d1 = ULONG  dos errcode (0 if all went ok)
  529.     ULONG    resload_SaveFile
  530.         ; save from BaseMem
  531.         ; IN :    d0 = LONG   length to save
  532.         ;    a0 = CPTR   name of file
  533.         ;    a1 = APTR   address
  534.         ; OUT :    d0 = BOOL   success
  535.         ;    d1 = ULONG  dos errcode (0 if all went ok)
  536.     ULONG    resload_SetCACR
  537.         ; sets the CACR (also ok with 68000's and from user-state)
  538.         ; IN :    d0 = ULONG  new cacr
  539.         ;    d1 = ULONG  mask (bits to change)
  540.         ; OUT :    d0 = ULONG  old cacr
  541.     ULONG    resload_ListFiles
  542.         ; list files in dir to buffer
  543.         ; IN :    d0 = ULONG  buffer size (a1)
  544.         ;    a0 = CPTR   name of directory to scan (relative)
  545.         ;    a1 = APTR   buffer (MUST reside in Slave !!!)
  546.         ; OUT :    d0 = ULONG  amount of listed names
  547.         ;    d1 = ULONG  dos errcode (0 if all went ok)
  548.     ULONG    resload_Decrunch
  549.         ; decrunch memory
  550.         ; IN :    a0 = APTR   source
  551.         ;    a1 = APTR   destination (can be equal to source)
  552.         ; OUT :    d0 = BOOL   success (size of file unpacked)
  553.     ULONG    resload_LoadFileDecrunch
  554.         ; IN :    a0 = CPTR   name of file (anywhere)
  555.         ;    a1 = APTR   address (MUST inside BaseMem !!!)
  556.         ; OUT :    d0 = BOOL   success (size of file)
  557.         ;    d1 = ULONG  dos errcode (0 if all went ok)
  558.     ULONG    resload_FlushCache
  559.         ; flush all caches
  560.         ; IN :    -
  561.         ; OUT :    -
  562.     ULONG    resload_GetFileSize
  563.         ; IN :    a0 = CPTR   name of file
  564.         ; OUT :    d0 = LONG   size of file or 0 if does'nt exist
  565.     ULONG    resload_DiskLoad
  566.         ; IN :    d0 = ULONG  offset
  567.         ;    d1 = ULONG  size
  568.         ;    d2 = ULONG  disk number
  569.         ;    a0 = APTR   destination
  570.         ; OUT :    d0 = BOOL   success
  571.         ;    d1 = ULONG  dos errorcode (if failed)
  572.  
  573. ******* the following functions require ws_Version >= 2
  574.  
  575.     ULONG    resload_DiskLoadDev
  576.         ; IN :    d0 = ULONG  offset
  577.         ;    d1 = ULONG  size
  578.         ;    a0 = APTR   destination
  579.         ;    a1 = STRUCT taglist
  580.         ; OUT :    d0 = BOOL   success
  581.         ;    d1 = ULONG  trackdisk errorcode (if failed)
  582.  
  583. ******* the following functions require ws_Version >= 3
  584.  
  585.     ULONG    resload_CRC16
  586.         ; IN :    d0 = ULONG  length
  587.         ;    a0 = APTR   address
  588.         ; OUT :    d0 = UWORD  crc checksum
  589.  
  590. ******* the following functions require ws_Version >= 5
  591.  
  592.     ULONG    resload_Control
  593.         ; IN :    a0 = STRUCT taglist
  594.         ; OUT :    d0 = BOOL   success
  595.     ULONG    resload_SaveFileOffset
  596.         ; save from BaseMem
  597.         ; IN :    d0 = ULONG  length to save
  598.         ;    d1 = ULONG  offset
  599.         ;    a0 = CPTR   name of file
  600.         ;    a1 = APTR   address
  601.         ; OUT :    d0 = BOOL   success
  602.         ;    d1 = ULONG  dos errcode (if failed)
  603.  
  604. ******* the following functions require ws_Version >= 6
  605.  
  606.     ULONG    resload_ProtectRead
  607.         ; IN :    d0 = ULONG  length
  608.         ;    a0 = CPTR   address
  609.         ; OUT :    -
  610.     ULONG    resload_ProtectReadWrite
  611.         ; IN :    d0 = ULONG  length
  612.         ;    a0 = CPTR   address
  613.         ; OUT :    -
  614.     ULONG    resload_ProtectWrite
  615.         ; IN :    d0 = ULONG  length
  616.         ;    a0 = CPTR   address
  617.         ; OUT :    -
  618.     ULONG    resload_ProtectRemove
  619.         ; IN :    d0 = ULONG  length
  620.         ;    a0 = CPTR   address
  621.         ; OUT :    -
  622.     ULONG    resload_LoadFileOffset
  623.         ; IN :    d0 = ULONG  offset
  624.         ;    d1 = ULONG  size
  625.         ;    a0 = CPTR   name of file
  626.         ;    a1 = APTR   destination
  627.         ; OUT :    d0 = BOOL   success
  628.         ;    d1 = ULONG  dos errorcode (if failed)
  629.  
  630. ******* the following functions require ws_Version >= 8
  631.  
  632.     ULONG    resload_Relocate
  633.         ; IN :    a0 = APTR   address of executable (source/destination)
  634.         ;    a1 = STRUCT taglist
  635.         ; OUT :    d0 = ULONG  size of relocated executable
  636.     ULONG    resload_Delay
  637.         ; IN :    d0 = ULONG  time to wait in 1/10 seconds
  638.         ; OUT :    -
  639.     ULONG    resload_DeleteFile
  640.         ; IN :    a0 = CPTR   name of file
  641.         ; OUT :    d0 = BOOL   success
  642.         ;    d1 = ULONG  dos errorcode (if failed)
  643.  
  644.     LABEL    resload_SIZEOF
  645.  
  646. ******* compatibility for older slave sources:
  647.  
  648. resload_CheckFileExist = resload_GetFileSize
  649.  
  650. ;=============================================================================
  651.  
  652.  ENDC
  653.